﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
namespace Pdf2ImageProcess
{
    class Program
    {
        /*函数需要两个参数1文件路径，2文件名*/
        static void Main(string[] args)
        {
            
            if (args.Length != 1)
            {
                Console.WriteLine("1 ");
                LocalLog.GetInstance().Write("1 输入参数个数错误。");
                return;
            }
            string[] inputParam = args[0].Split(new char[] { '|' }, StringSplitOptions.None);
            if (inputParam.Length != 2)
            {
                Console.WriteLine("1 ");
                LocalLog.GetInstance().Write("参数个数应该为2");
                return;
            }
            List<string> listParam = inputParam.ToList();
            
            string filepath = listParam[0];
            listParam.RemoveAt(0);
            string guid = listParam[0];
            listParam.RemoveAt(0);

            PDFThread pdfth = new PDFThread();
            if(pdfth.pdf2Image(filepath, guid))
                Console.WriteLine("0 ");
            else
                Console.WriteLine("2 ");
        }
    }
}
